<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns:th="http://www.thymeleaf.org"> 
<head>
    <title>购物车</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
    <link rel="stylesheet" href="lib/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body ontouchstart>
<header class="wy-header">
    <div class="wy-header-icon-back"  onclick="back();"><span></span></div>
    <div class="wy-header-title">购物车</div>
</header>
<div id="shoppingtable">
<div th:each="list1:${list}">
    <div th:each="lst:${list1.goods}">
        <div class="weui-panel weui-panel_access">
            <div class="weui-panel__hd"><span th:text="${lst.goodsName}"></span><a href="javascript:;" class="wy-dele"><span  th:text="${list1.id}" id="goodsid" style="display: none"></span></a></div>
            <div class="weui-panel__bd">
                <div class="weui-media-box_appmsg pd-10">
                    <div class="weui-media-box__hd check-w weui-cells_checkbox">
                        <label class="weui-check__label">
                            <div class="weui-cell__hd cat-check"><input type="checkbox" class="weui-check  shop"  name="cartpro" id="cart-pto1"><i class="weui-icon-checked"></i></div>
                        </label>
                    </div>
                    <div class="weui-media-box__hd"><a href="pro_info.html" th:each="listimg:${lst.images}"><img class="weui-media-box__thumb" th:src="${listimg.path}" alt=""></a></div>
                    <div class="weui-media-box__bd">
                        <h1 class="weui-media-box__desc"><a href="pro_info.html" class="ord-pro-link"><span th:text="${lst.goodsDsc}"></span></a></h1>
                        <p class="weui-media-box__desc">规格：<span th:text="${lst.model}"></span></p>
                        <div class="clear mg-t-10">
                           <div class="wy-pro-pri fl">¥<em class="num font-15"><span th:text="${lst.price}" class="price">
                               <!--获取对应商品的总价和数量-->
                            </span><span  class="totalprice" style="display: none"></span>
                               <span  class="amount" style="display: none" th:text="${list1.amount}"></span>
                           <span  th:text="${lst.id}" class="goodsid" style="display: none"></span>
                           </em></div>
                            <div class="pro-amount fr"><div class="Spinner numb" name="number"></div></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<!--底部导航-->
<div class="foot-black"></div>

<div class="weui-tabbar wy-foot-menu">
    <!--<div class="npd cart-foot-check-item weui-cells_checkbox allselect">-->
        <!--<label class="weui-cell allsec-well weui-check__label" for="all">-->
            <!--<div class="weui-cell__hd">-->
                <!--<input type="checkbox" class="weui-check" name="all-sec" id="all">-->
                <!--<i class="weui-icon-checked"></i>-->
            <!--</div>-->
            <!--<div class="weui-cell__bd">-->
                <!--<p class="font-14">全选</p>-->
            <!--</div>-->
        <!--</label>-->
    <!--</div>-->

    <div class="weui-tabbar__item  npd">
        <p class="cart-total-txt">合计：<i>￥</i><em class="num font-16" id="zong1">0.00</em></p>
    </div>
    <a href="javascript:zhifubyshoping();" class="red-color npd w-90 t-c">
        <p class="promotion-foot-menu-label">去结算</p>
    </a>
</div>


<script src="lib/jquery-2.1.4.js"></script>
<script src="lib/fastclick.js"></script>
<script type="text/javascript" src="js/jquery.Spinner.js"></script>
<script type="text/javascript">
    function zhifubyshoping() {
        var shops = document.getElementsByClassName("shop");
        var ide="";
        for (var i = 0; i < shops.length; i++) {
            var $v = $(shops[i]);
            if (shops[i].checked==true) {
                ide = ide + $v.closest('.pd-10').find('.goodsid').text() + ","
            }
        }
        window.location.href="add_oneorder.htm?str="+ide;
    }
</script>
<script>
    $(function() {
        FastClick.attach(document.body);
    });
</script>
<!--单个物品的加减-->
<script type="text/javascript">
    $(function(){
        //$(".Spinner").Spinner({value:1, len:3, max:999});
        var Spinner = document.getElementsByClassName("Spinner");
        for (var i = 0; i < Spinner.length; i++) {
            var $v = $(Spinner[i]);
            $v.Spinner({value:$v.closest('.weui-panel').find('.amount').text(), len:3, max:999});
        }
    });
</script>
<script src="js/jquery-weui.js"></script>
<!---全选按钮-->
<script type="text/javascript">
    $(document).ready(function () {
        $(".allselect").click(function () {
            if($(this).find("input[name=all-sec]").prop("checked")){
                $("input[name=cartpro]").each(function () {
                    $(this).prop("checked", true);
                });

            }
            else
            {
                $("input[name=cartpro]").each(function () {
                    if ($(this).prop("checked")) {
                        $(this).prop("checked", false);
                    } else {
                        $(this).prop("checked", true);
                    }
                });
            }
            aaaa();
        });
    });
</script>

<script type="text/javascript">

        function aaaa() {
            var allMoney = 0;
            var shops = document.getElementsByClassName("shop");
            var ide="";
            for (var i = 0; i < shops.length; i++) {
                var $v = $(shops[i]);
                if (shops[i].checked==true) {
                    ide = ide + $v.closest('.pd-10').find('.goodsid').text() + ","
                }
            }
            jQuery.ajax({
                url: "shopChang1.htm",
                data: {"goodsid": ide},
                type: "post",
                success: function (message01) {
                    allMoney = allMoney + parseFloat(message01);
                    $("#zong1").text(allMoney);
                },
                error: function () {
                    alert("error!");
                }
            });
        }

        $('.weui-check').bind('click', function () {
            aaaa();
        });

        function back() {
            history.back();
        }



</script>
<!--删除单条数据-->
<script>
    $(document).on("click", ".wy-dele", function() {
        $.confirm("您确定要把此商品从购物车删除吗?", "确认删除?", function() {;
                var  goodsid=$("#goodsid").text();
                alert(goodsid);
                jQuery.ajax({
                    url:"del_one.htm",
                    data:{"goodsid":goodsid},
                    type:"post",
                    success:function(message01){
                        if(message01 == 1){
                            $.toast("商品已经移除!");
                            window.location.reload();
                        }
                    },
                    error:function(){
                        alert("error!");
                    }
                })
        }, function() {
            //取消操作
        });
    });

</script>


</body>
</html>